<link href="application/MyFolder/program/style/upload.css" rel="stylesheet" type="text/css" />

<script src="application/MyFolder/program/source/script/upload/swfupload.js"></script>

<script src="application/MyFolder/program/source/script/upload/swfupload.queue.js"></script>

<script src="application/MyFolder/program/source/script/upload/fileprogress.js"></script>

<script src="application/MyFolder/program/source/script/upload/handlers.js"></script>

<script>

	var uploadConfig = function (key) {

		return jUploadTemplate.data.config.find('upload add[key=' + key + ']').attr('value');

	}

	uploadfile = function () {

		var settings = {

			flash_url: uploadConfig('flash_url'),

			upload_url: uploadConfig('upload_url'),

			post_params: { sessionID : 1, parentID : jUploadTemplate.state.parent, size: jUploadTemplate.get('size') },

			file_size_limit: uploadConfig('file_size_limit'),

			file_types: uploadConfig('file_types'),

			file_types_description: "All Files",

			file_upload_limit: uploadConfig('file_upload_limit'),

			custom_settings: {

				progressTarget: "fsUploadProgress",

				cancelButtonId: "btnCancel"

			},

			debug: false,

			button_image_url: "style/images/upload-button.png",

			button_width: 68,

			button_height: 26,

			button_placeholder_id: "spanButtonPlaceHolder",

			button_text: '<span class="button">浏览</span>',

			button_text_style: ".button{color:#ffffff;font-size:12px;}",

			button_text_left_padding: 19,

			button_text_top_padding: 3,

			swfupload_loaded_handler: function () {
				
				$('#divStatus').find('span').fadeOut(function () {

					$(this).html('加载成功');

					$(this).fadeIn(

						function () {

							$(this).fadeOut(1500);

						}

					);

				});

			},

			file_queued_handler: fileQueued,

			file_queue_error_handler: fileQueueError,

			file_dialog_complete_handler: fileDialogComplete,

			upload_start_handler: uploadStart,

			upload_progress_handler: uploadProgress,

			upload_error_handler: uploadError,

			upload_success_handler: uploadSuccess,

			upload_complete_handler: uploadComplete,

			queue_complete_handler: queueComplete

		};

		swfu = new SWFUpload(settings);

	}
	
	upload_error = function (con) {
		
		$.jLayer.alert({
		
			title: '警告',
			
			subject: con,

			background: '#fff'
			
		});
		
	}

	upload_success = function (con) {

		$.jLayer.alert({

			title: '上传成功',

			subject: con,

			background: '#fff',

			sure: function () {
			
				$.jLayer.close('#jUploadTemplateSwfUploadLayer');
						
				jUploadTemplate.menu.refresh();
			
			}

		});

	}

	$(document).ready(

		function () {

			uploadfile();

			$('.file_upload_limit').html(uploadConfig('file_upload_limit'));
			$('.file_types').html(uploadConfig('file_types'));
			$('.file_size_limit').html(uploadConfig('file_size_limit'));

		}

	);

</script>

<div class="upload-div">
	<div class="upload-tip">！您一次可以同时上传 <span class="file_upload_limit"></span> 个文件，支持的文件类型有 <span class="file_types"></span>，大小限制在 <span class="file_size_limit"></span></span> </div>
	<form method="post" enctype="multipart/form-data">
		<div class="fieldset flash" id="fsUploadProgress"> <span class="legend">上传列表</span> </div>
		<div class="upload-button">
			<span id="spanButtonPlaceHolder"></span>
			<a href="javascript:;" onfocus="this.blur()" id="btnCancel" class="button" onclick="swfu.cancelQueue();">取消所有上传</a>
			<span id="divStatus"><span>正在加载控件，请稍后</span></span>
		</div>
	</form>
</div>